package com.alisls.demo.springcloud.service.user.dto.employee;

import com.alisls.demo.springcloud.service.user.dto.user.UserDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * 员工DTO
 *
 * @author Ke Wang
 * @date 2020/10/30
 */
@Getter
@Setter
@NoArgsConstructor
@ToString
public class EmployeeDTO implements Serializable {

    @ApiModelProperty(value = "员工标识", example = "1234567890123456789")
    private Long id;

    @ApiModelProperty(value = "员工编码", example = "20200101")
    @NotBlank(message = "员工编码不能为空！")
    private String employeeNo;

    @ApiModelProperty(value = "用户昵称", required = true, example = "小可")
    @NotBlank(message = "用户昵称不能为空！")
    @Size(min = 2, max = 30, message = "用户昵称的长度介于2~30个字符之间")
    private String nickname;

    @ApiModelProperty(value = "用户名称", required = true, example = "可")
    @Size(min = 2, max = 30, message = "用户名称的长度介于2~30个字符之间")
    private String firstname;

    @ApiModelProperty(value = "用户姓氏", required = true, example = "王")
    @Size(min = 2, max = 30, message = "用户姓氏的长度介于2~30个字符之间")
    private String lastname;

    @ApiModelProperty(value = "手机号码", example = "150xxxx5831")
    @Size(min = 2, max = 30, message = "手机号码的长度介于2~30个字符之间")
    private String mobile;

    @ApiModelProperty(value = "电子邮件", example = "xxx@163.com")
    @Size(min = 2, max = 30, message = "电子邮箱的长度介于2~30个字符之间")
    @Email(message = "邮箱地址不合法")
    private String email;

    @ApiModelProperty(value = "年龄", allowableValues = "@code range[1, 150]")
    private Integer age;

    /**
     * 一个员工有多个用户
     */
    private List<UserDTO> users;

}
